<%--
  Created by IntelliJ IDEA.
  User: 联想小鑫
  Date: 2021/11/15
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.min.js"></script>
    <script src="js/fileupload.js"></script>
    <script src="My97DatePicker/WdatePicker.js"></script>
</head>
<body>
<form enctype="multipart/form-data">
    订单编号: <input type="text" name="ddbh" id="ddbh" value="${s}" readonly>
    订单日期: <input type="text" name="dddate" id="dddate" onclick="WdatePicker()"> <br>
    客户名称: <input type="text" name="name" id="name">
    联系人: <input type="text" name="lxr" id="lxr">
    联系电话: <input type="text" name="phone" id="phone"> <br>
    优先级:
    <select name="yxj" id="yxj">
        <option value="">请选择</option>
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
    </select>
    送货地址: <input type="text" name="address" id="address"> <br>
    制单人工号: <input type="text" name="gh" id="gh">
    制单人: <input type="text" name="zdname" id="zdname">
    制单时间: <input type="text" name="zddate" id="zddate" onclick="WdatePicker()"> <br>
    总金额: <input type="text" name="price" id="price">
    附件: <input type="file" name="photo" id="fujian"> <br>
    备注: <input type="text" name="beizhu" id="beizhu"> <br>
</form>
<button id="add">添加</button>
<table id="tab" border="1">
    <tr>
        <td>订单编号</td>
        <td>订单日期</td>
        <td>客户名称</td>
        <td>联系人</td>
        <td>联系电话</td>
        <td>优先级</td>
        <td>送货地址</td>
        <td>制单人工号</td>
        <td>制单人</td>
        <td>制单时间</td>
        <td>总金额</td>
        <td>附件</td>
        <td>备注</td>
    </tr>
</table>
<button id="adddingdan">添加</button>
</body>
<script>
    $("#add").click(function () {
        $("#tab").append(
            "<tr><td>"+$("#ddbh").val()+"</td><td>"+$("#dddate").val()+"</td><td>"+$("#name").val()+"</td><td>"+$("#lxr").val()+"</td><td>"+$("#phone").val()+"</td><td>"+$("#yxj").val()+"</td><td>"+$("#address").val()+"</td>" +
            "<td>"+$("#gh").val()+"</td><td>"+$("#zdname").val()+"</td><td>"+$("#zddate").val()+"</td><td>"+$("#price").val()+"</td><td>"+$("#fujian").val()+"</td><td>"+$("#beizhu").val()+"</td></tr>"
        )
    })
    $("#adddingdan").click(function () {
        var formData=new FormData($("form")[0]);
        $.ajax({
            url:"adddingdan.do",
            data:formData,
            dataType:"json",
            type:"post",
            success:function (a) {
                if(a>0){
                    alert("添加成功");
                    location="list.do";
                }
            },
            processData: false,
            contentType:false,
        })
    })
</script>
</html>
